package com.abbas.abchat;

import android.app.Application;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import com.abbas.abchat.activity.BaseActivity;
import com.abbas.abchat.db.Sqlite;
import com.abbas.abchat.entity.Account;

import java.util.HashMap;
import java.util.List;

/**
 * @author abbas
 * @description: TODO
 * @date 2022/4/13 14:53
 */
public class AbChatApplication extends Application {

    private static Account mAccount;
    private Context context = this;
    private static HashMap<String, BaseActivity> ac = new HashMap<>();

//    private static List<Integer> peopleId;
//    private Sqlite sqlite = new Sqlite(context,Sqlite.DB_NAME,null,1);

    @Override
    public void onCreate() {
        super.onCreate();
    }

//    public SQLiteDatabase getWriteableDatabase(){
//        return sqlite.getWritableDatabase();
//    }
//
//    public SQLiteDatabase getReadableDatabase(){
//        return sqlite.getReadableDatabase();
//    }

    public static void setAccount(Account account) {
        mAccount = account;
    }

    public static Account getAccount() {
        return mAccount;
    }

    public static void putActivityTask(BaseActivity activity){
        ac.put(activity.getClass().getSimpleName(),activity);
    }

    public static void finishActivity(String TAG){
        if (ac.containsKey(TAG)){
            BaseActivity activity = ac.get(TAG);
            if (activity != null){
                activity.finish();
            }
        }
    }
//
//    public static List<Integer> getPeopleId() {
//        return peopleId;
//    }
//
//    public static void setPeopleId(List<Integer> peopleId) {
//        AbChatApplication.peopleId = peopleId;
//    }
}
